package storage

import (
	"IrisStandard/config"
	"IrisStandard/util"
	"gopkg.in/mgo.v2"
)

var (
	MongoDb *mgo.Database
)

func init() {
	//连接数据库
	session , err := mgo.Dial(config.Setting.Mongodb.Host + ":" + config.Setting.Mongodb.Port)
	util.FailOnException("An error occurred while connecting to MongoDB", err)
	session.SetMode(mgo.Monotonic,true)
	//返回数据库操作句柄
	MongoDb = session.DB(config.Setting.Mongodb.DbName)
}